package org.gruposp2p.aula.gwt.client.content.course;

import org.gruposp2p.aula.gwt.client.AulaApplication;
import org.gruposp2p.aula.gwt.client.AulaConstants;
import org.gruposp2p.aula.gwt.client.model.Course;
import org.gruposp2p.aula.gwt.client.model.Student;
import org.gruposp2p.aula.gwt.client.representation.StudentsRepresentation;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.Constants;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

public class CourseDataPanel extends VerticalPanel {
	
	private AulaApplication aulaApplication;
	private AulaConstants constants;
	private TextBox nameTextBox;
	private TextBox descriptionTextBox;
	
	public CourseDataPanel (AulaApplication aulaApplication) {
		this.aulaApplication = aulaApplication;
		this.constants = aulaApplication.getConstants();
		setTitle(constants.NewStudentDialogBoxCaption()); 

		add(new Label(constants.NewStudentDialogBoxNameLabel()));
	    nameTextBox = new TextBox ();
	    add(nameTextBox);

	    add(new Label(constants.NewStudentDialogBoxDescriptionLabel()));
	    descriptionTextBox = new TextBox();
	    add(descriptionTextBox);



	    // Add a close button at the bottom of the dialog
	    Button cancelButton = new Button(constants.CancelButtonCaption(),
	        new ClickHandler() {
	          public void onClick(ClickEvent event) {  
	            
	          }
	        });
	    
	    Button acceptButton = new Button(constants.AcceptButtonCaption(),
		        new ClickHandler() {
		          public void onClick(ClickEvent event) {
		        	  

		          }
		        });
	    
	    Button getButton = new Button("GET",
		        new ClickHandler() {
		          public void onClick(ClickEvent event) {
		        	  StudentsRepresentation.getInstance().getStudents();
		          }
		        });
	    
	    HorizontalPanel hPanel = new HorizontalPanel();
	    hPanel.setSpacing(5);
	    hPanel.add(getButton);
	    hPanel.add(cancelButton);
	    hPanel.add(acceptButton);
	    
	    add(hPanel);

	    //To solve Firefox strange effect
	    nameTextBox.setFocus(true);		
	}
	
}
